package com.jic.order.api;

import com.jic.common.base.vo.RestResult;
import com.jic.order.request.CreateParentOrderRequest;
import com.jic.order.request.OrderParentSaleRequest;
import com.jic.order.request.OrderReturnRequest;
import com.jic.order.request.OrderSaleRequest;
import com.jic.order.response.OrderAllAmountResponse;
import com.jic.order.response.OrderDetailInfo;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "jic-order", path = "/feign")
public interface OrderApi {

	/**
	 * description: 创建订单
	 *
	 * @author: jackHe
	 * @time: 2020/8/8 14:10
	 */
	@PostMapping("/createOrder")
	RestResult<String> create(@RequestBody CreateParentOrderRequest createParentOrderRequest);

	@PostMapping("/queryOrderAllAmountByMember")
	RestResult<List<OrderAllAmountResponse>> queryOrderAllAmountByMember(@RequestBody List<Long> memberId);

	/**
	 * 将父订单状态 6.待评价 改为 10.已完成
	 */
	@PostMapping("/updateParentOrderStatus")
	RestResult<Boolean> updateParentOrderStatus(@RequestParam(value = "orderNo") String orderNo);

	/**
	 * 根据订单信息返回订单相关数据
	 *
	 * @param orderNo
	 * @return
	 */
	@PostMapping("/getOrderInfoByOrderNo")
	RestResult<OrderDetailInfo> getOrderInfoByOrderNo(@RequestParam(value = "orderNo") String orderNo);

	/**
	 * 根据分销员ids返回最近一小时支付成功的订单相关数据
	 *
	 * @param distributorIds
	 * @return
	 */
	@PostMapping("/getOrderInfoByBuyIds")
	List<OrderParentSaleRequest> getOrderInfoByBuyIds(@RequestBody List<Long> distributorIds);

	/**
	 * 根据父订单获取子订单数据
	 *
	 * @param orderNo
	 * @return
	 */
	@PostMapping("/queryOrderInfoByOrderNo")
	List<OrderSaleRequest> queryOrderInfoByOrderNo(@RequestBody List<String> orderNo);

	/**
	 * 根据订单号查询退款数据
	 *
	 * @param orderNo
	 * @return
	 */
	@PostMapping("/queryOrderRefundByOrderNo")
	List<OrderReturnRequest> queryOrderRefundByOrderNo(@RequestBody String orderNo);
}
